﻿using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Journal.Domain.Models;
using Journal.Front.Presentation.Models.StudyGroupModels.Items;

namespace Journal.Front.Presentation.Models.StudyGroupModels
{
    public class StudyGroupSelectModel
    {
        public StudyGroupSelectModel(IEnumerable<StudyGroup> groups)
        {
            Items = groups.Select(x => new SelectListItem() { Value = x.Id.ToString(), Text = x.Name}).ToList();
            Id = groups.FirstOrDefault().Id;
        }

        public int Id { get; set; }

        public IEnumerable<SelectListItem> Items { get; set; }
    }
}